package com.cgs.query.handler

import com.cgs.query.domain.BoundSql
import java.sql.Connection
import java.sql.Statement

/**ִ数据库执行器*/
interface StatementHandler {

    val boundSql: BoundSql

    val parameterHandler: ParameterHandler

    /**获取Statement*/
    fun prepare(connection: Connection): Statement

    /**参数注入Statement*/
    fun parameterize(statement: Statement)

    /**更新操作*/
    fun update(statement: Statement): Int

    /**查询操作*/
    fun query(statement: Statement): List<Any>

    /**关闭*/
    fun close(statement: Statement?)

    /** 执行sql语句,自动解析参数*/
    fun execute(statement: Statement): List<Any>
}